package golf.stockinfo.simulationweb.core;

import golf.stockinfo.buysellsimulation.SimulationCommonUtils;


public class SimulationOutput implements Comparable<SimulationOutput>{

	private double initialCapital;
	private short smavETF;
	private short smavTFEX;
	private boolean playLong;
	private boolean playShort;
	private boolean playETFonLong; 
	private double maxLossOnBalanceForTFEX; 
	private double maxLossOnBalanceForETF; 
	private double lossStopThresholdPerContract;
	private int cappedContractNumber; 
	private double profitTakingThresholdETF; 
	private double profitTakingThresholdTFEX; 
	private boolean profitTaking; 
	private boolean isContinousInvesting; 
	private double allowedMinimumRunningBalance;
	private double averageEndBalance;
	private double averageEffectiveInterestRate;
	
	public SimulationOutput(
			double _initialCapital,
			short _smavETF,
			short _smavTFEX,
			boolean _playLong,
			boolean _playShort,
			boolean _playETFonLong,
			double _maxLossOnBalanceForTFEX,
			double _maxLossOnBalanceForETF,
			double _lossStopThresholdPerContract,
			int _cappedContractNumber,
			double _profitTakingThresholdETF,
			double _profitTakingThresholdTFEX,
			boolean _profitTaking,
			boolean _isContinousInvesting,
			double _allowedMinimumRunningBalance){
		
		this.initialCapital = _initialCapital;
		this.smavETF = _smavETF;
		this.smavTFEX = _smavTFEX;
		this.playLong = _playLong;
		this.playShort = _playShort;
		this.playETFonLong = _playETFonLong;
		this.maxLossOnBalanceForTFEX = _maxLossOnBalanceForTFEX;
		this.maxLossOnBalanceForETF = _maxLossOnBalanceForETF;
		this.lossStopThresholdPerContract = _lossStopThresholdPerContract;
		this.cappedContractNumber = _cappedContractNumber;
		this.profitTakingThresholdETF = _profitTakingThresholdETF;
		this.profitTakingThresholdTFEX = _profitTakingThresholdTFEX;
		this.profitTaking = _profitTaking;
		this.isContinousInvesting = _isContinousInvesting;
		this.allowedMinimumRunningBalance = _allowedMinimumRunningBalance;
		
	}
	
	public double getInitialCapital() {
		return initialCapital;
	}
	public void setInitialCapital(double initialCapital) {
		this.initialCapital = initialCapital;
	}
	public short getSmavETF() {
		return smavETF;
	}
	public void setSmavETF(short smavETF) {
		this.smavETF = smavETF;
	}
	public short getSmavTFEX() {
		return smavTFEX;
	}
	public void setSmavTFEX(short smavTFEX) {
		this.smavTFEX = smavTFEX;
	}
	public boolean isPlayLong() {
		return playLong;
	}
	public void setPlayLong(boolean playLong) {
		this.playLong = playLong;
	}
	public boolean isPlayShort() {
		return playShort;
	}
	public void setPlayShort(boolean playShort) {
		this.playShort = playShort;
	}
	public boolean isPlayETFonLong() {
		return playETFonLong;
	}
	public void setPlayETFonLong(boolean playETFonLong) {
		this.playETFonLong = playETFonLong;
	}
	public double getMaxLossOnBalanceForTFEX() {
		return maxLossOnBalanceForTFEX;
	}
	public void setMaxLossOnBalanceForTFEX(double maxLossOnBalanceForTFEX) {
		this.maxLossOnBalanceForTFEX = maxLossOnBalanceForTFEX;
	}
	public double getMaxLossOnBalanceForETF() {
		return maxLossOnBalanceForETF;
	}
	public void setMaxLossOnBalanceForETF(double maxLossOnBalanceForETF) {
		this.maxLossOnBalanceForETF = maxLossOnBalanceForETF;
	}
	public double getLossStopThresholdPerContract() {
		return lossStopThresholdPerContract;
	}
	public void setLossStopThresholdPerContract(double lossStopThresholdPerContract) {
		this.lossStopThresholdPerContract = lossStopThresholdPerContract;
	}
	public int getCappedContractNumber() {
		return cappedContractNumber;
	}
	public void setCappedContractNumber(int cappedContractNumber) {
		this.cappedContractNumber = cappedContractNumber;
	}
	public double getProfitTakingThresholdETF() {
		return profitTakingThresholdETF;
	}
	public void setProfitTakingThresholdETF(double profitTakingThresholdETF) {
		this.profitTakingThresholdETF = profitTakingThresholdETF;
	}
	public double getProfitTakingThresholdTFEX() {
		return profitTakingThresholdTFEX;
	}
	public void setProfitTakingThresholdTFEX(double profitTakingThresholdTFEX) {
		this.profitTakingThresholdTFEX = profitTakingThresholdTFEX;
	}
	public boolean isProfitTaking() {
		return profitTaking;
	}
	public void setProfitTaking(boolean profitTaking) {
		this.profitTaking = profitTaking;
	}
	public boolean isContinousInvesting() {
		return isContinousInvesting;
	}
	public void setContinousInvesting(boolean isContinousInvesting) {
		this.isContinousInvesting = isContinousInvesting;
	}
	public double getAllowedMinimumRunningBalance() {
		return allowedMinimumRunningBalance;
	}
	public void setAllowedMinimumRunningBalance(double allowedMinimumRunningBalance) {
		this.allowedMinimumRunningBalance = allowedMinimumRunningBalance;
	}
	public double getAverageEndBalance() {
		return averageEndBalance;
	}
	public void setAverageEndBalance(double averageEndBalance) {
		this.averageEndBalance = averageEndBalance;
	}
	public double getAverageEffectiveInterestRate() {
		return averageEffectiveInterestRate;
	}
	public void setAverageEffectiveInterestRate(double averageEffectiveInterestRate) {
		this.averageEffectiveInterestRate = averageEffectiveInterestRate;
	}
	
	public int compareTo(SimulationOutput o) {
		return Double.valueOf(averageEffectiveInterestRate).compareTo(o.getAverageEffectiveInterestRate());
	}
	
	@Override
	public String toString(){
		return SimulationCommonUtils.formatAmount(initialCapital) + ";" +
				smavETF + ";" +
				smavTFEX + ";" +
				playLong + ";" +
				playShort + ";" +
				playETFonLong + ";" + 
				SimulationCommonUtils.formatAmount(maxLossOnBalanceForTFEX) + ";" + 
				SimulationCommonUtils.formatInterest(maxLossOnBalanceForETF) + ";" + 
				SimulationCommonUtils.formatAmount(lossStopThresholdPerContract) + ";" +
				cappedContractNumber + ";" + 
				SimulationCommonUtils.formatInterest(profitTakingThresholdETF) + ";" + 
				SimulationCommonUtils.formatInterest(profitTakingThresholdTFEX) + ";" + 
				profitTaking + ";" + 
				isContinousInvesting + ";" + 
				SimulationCommonUtils.formatAmount(allowedMinimumRunningBalance) + ";" +
				SimulationCommonUtils.formatAmount(averageEndBalance) + ";" +
				SimulationCommonUtils.formatInterest(averageEffectiveInterestRate);
					
	}

}
